home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
pc_board
/
pcbcht10.zip
/
PCBCHAT.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1991-10-22
|
6KB
|
160 lines
(* PCBChat: Set the caller's Node Chat Status to either 'A'vailable or *)
(* 'U'navailable, as desired by sysop. Designed to be run in *)
(* the $$LOGON.BAT file of PCBoard 14.5a *)
(* Written in Turbo Pascal 6.0 by Lance Williams, 10/22/91 *)
(* *)
(* This source code and program is donated to the public domain for *)
(* instructive purposes. You are free to use any part of the code in *)
(* any of your porgrams, as long as you give me some credit. *)
(* *)
(* This program makes use of the MdosIO Unit from SAM SMITH, available *)
(* in the PROKIT or TOOLS libraries on THE TOOL SHOP, his BBS *)
program secfiles;
{$M 2048, 4096, 4096}
uses dos, MdosIO;
type
char2 = array[1..2] of char;
char4 = array[1..4] of char;
char5 = array[1..5] of char;
char6 = array[1..6] of char;
char12 = array[1..12] of char;
char13 = array[1..13] of char;
char15 = array[1..15] of char;
char24 = array[1..24] of char;
char25 = array[1..25] of char;
char30 = array[1..30] of char;
bitmap = array[1..5] of char;
{layout of the USERNET.DAT file}
UserNet_Rec = record
{1 }Status: char2; {Node Number in Chat or Status}
{3 }NodeNum: char2; {Node Number or Blank if Down}
{5 }Caller: char25; {Name of the caller online}
{30}City: char24; {City/State of caller}
{record size = 53}
end;
{layout of the PCBOARD.SYS file while doors are open}
pcb_sys_rec = record
{1 }display: char2; {display on console? -1 or 0}
{3 }printer: char2; {print log? -1 or 0}
{5 }page_bell: char2; {bother sysop? -1 or 0}
{7 }alarm: char2; {caller alarm sound? -1 or 0}
{9 }sysop_next: char; {force sysop on next? 'N', 'X' or ' '}
{10 }errcheck: char2; {error check/correcting modem? -1 or 0}
{12 }graphics: char; {ansi graphics mode? 'Y','N','7'}
{13 }nodechat: char; {node chat status 'U' or 'A'}
{14 }openbps: char5; {BPS rate to open modem port at}
{19 }connectbps: char5; {BPS connect rate or 'Local'}
{24 }usernum: integer; {record number in user file}
{26 }firstname: char15; {caller's first name}
{41 }password: char12; {caller's password}
{53 }time_on: integer; {when the user logged on in MINUTES}
{55 }prev_used: integer; {minutes used in prev calls today, <0}
{57 }time_logged: char5; {hh:mm time the user logged on}
{62 }time_limit: integer; {maximum minutes allowed from PWRD}
{64 }down_limit: integer; {daily download limit/1024 from PWRD}
{66 }curconf: byte; {active conference when door opened}
{67 }joined: bitmap; {areas user has been in}
{72 }ydone: bitmap; {areas user has done 'Y' on}
{77 }time_added: integer; {highest conference added time in mins}
{79 }time_credit: integer; {upload/chat time credit in minutes}
{81 }slanguage: char4; {language used, blank, .FRE etc}
{85 }name: char25; {caller's full name}
{110}sminsleft: integer; {minutes left when door opened}
{112}snodenum: byte; {current node number}
{113}seventtime: char5; {hh:mm event time}
{118}seventactive: char2; {event time active? "-1" or "0 "}
{120}sslide: char2; {slide event? "-1" or " 0"}
{122}smemmsg: single; {memorized message number}
{126}scomport: char; {com port number '0','1','2'}
{127}fill99: char2 {filler UNDOCUMENTED}
{record size: 128}
end;
var
pcbsys: pcb_sys_rec;
pcbsysfile: file of pcb_sys_rec;
usernet: usernet_rec;
datfile: text;
linecnt: integer;
Usernet_filename: string;
error_code, nodenum, handle: word;
setting: string;
begin
write('Running PCBChat and setting CHAT status to ',paramstr(1),'.');
setting := Paramstr(1);
{Parameter Options: [A]vailable or [U]navailable}
write('.');
{Set PCBOARD.SYS file}
assign(pcbsysfile, 'PCBOARD.SYS');
reset(pcbsysfile);
read(pcbsysfile,pcbsys);
write('.');
{In Pascal, the first record is 0, not 1}
nodenum := pcbsys.snodenum - 1;
{Get the Location of the USERNET.DAT file}
assign(datfile, 'PCBOARD.DAT');
reset(datfile);
{path/filename of the USERNET.DAT file is on line #41 of PCBOARD.DAT}
for linecnt := 1 to 41 do
readln(datfile,usernet_filename);
close(datfile);
write('.');
{Set the USERNET.DAT file}
{Uses MdosIO unit form Sam Smith for Shared File access}
handle := dos_open(usernet_filename,open_update);
dos_rseek(handle,nodenum,53,seek_start);
error_code := dos_read(handle,usernet,53);
write('.');
{Set all the Files for Chat Status Settings}
{Uses complete checking, to weed out improper command line parameters}
if upcase(setting[1]) = 'A' then
begin
pcbsys.nodechat := 'A';
usernet.status := 'A ';
end
else if upcase(setting[1]) = 'U' then
begin
pcbsys.nodechat := 'U';
usernet.status := 'U ';
end
else
begin
{Display Error Message}
writeln;
writeln('Bad Parameter Passed.....');
writeln;
writeln('Program Exit Code = 1');
{Close open files}
close(pcbsysfile);
dos_close(handle);
{Halt program with errorlevel = 1}
halt(1);
end;
write('.');
{Write the new PCBOARD.SYS file}
seek(pcbsysfile,0); {Reset PCBOARD.SYS to top of file}
write(pcbsysfile, pcbsys);
close(pcbsysfile);
write('.');
{Use MdosIO to write the new record in the USERNET.DAT file}
dos_rseek(Handle,nodenum,53,seek_Start);
dos_write(handle,usernet,53);
dos_close(handle);
writeln('.Done');
end.